﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Communergy.NationalGridDataServices;
using Communergy.Repository;
using Communergy.Repository.EntityFramework;

namespace Communergy.NationalGridDataServices
{
    public class NationalGridDataHelper
    {
        public static LiveCarbonIntensity CreateLiveCarbonIntensity(electricityCO2Item liveCarbonIntensity)
        {
            if (liveCarbonIntensity != null)
            {
                var newCarbonIntensity = new LiveCarbonIntensity
                {
                    lc_startDateTime = liveCarbonIntensity.startDateGMT,
                    lc_endDateTime = liveCarbonIntensity.endDateGMT,
                    lc_carbonIntensity = liveCarbonIntensity.amount,
                    lc_rollingMeanStartDateTime = liveCarbonIntensity.hhRollingMean.startDateGMT,
                    lc_rollingMeanEndDateTime = liveCarbonIntensity.hhRollingMean.endDateGMT,
                    lc_rollingMeanCarbonIntensity = liveCarbonIntensity.hhRollingMean.value
                };
                return newCarbonIntensity;
            }
            else
            {
                return null;
            }
        }
    }
}
